<?php
#data
$_POST[due]='';
$_POST[mail]='new';
$_POST[requestor]='Isuzu';
$_POST[subject]='Isuzu Price update';
$row[Line]='1';
$_POST[problem]='Isuzu Price update due';
$_POST[branch]='01';
$_POST[department]='Parts';





require_once "c:/xampp/htdocs/vhs/Common/database.php";
require_once "c:/xampp/htdocs/vhs/Common/values.php";


$result1="SELECT * FROM tblJobs WHERE LogNumber LIKE '%$datelog%' ORDER BY LogNumber DESC";
$result = mysql_query($result1);
$logid = 1;

$dateloglimit = $datelog+1 ;
$dateloglimit=$dateloglimit.'0';

$row = mysql_fetch_array($result);




if ($date==$row['Date'])
{


$Log=$row['LogNumber']+1;
if ($Log==$dateloglimit)
{
$Log=$datelog.'10';
}
 
}
else
{
$Log=$datelog.$logid ;

}





$result=mysql_query("SELECT * FROM tblstatus WHERE Name='$_POST[status]'");
$row = mysql_fetch_array($result);

$query="INSERT INTO tblJobs  VALUES ('$Log','Plympuma2','$_POST[requestor]','$_POST[subject]','$time','$date','Medium','$row[Line]','Pending','$_POST[problem]','$_POST[branch]','$_POST[department]','$_POST[phone]','$_POST[vnc]','$_POST[due]','Not Assigned','','','helpdesk','','$_POST[mailupdates]')";
mysql_query($query);
mysql_query("INSERT INTO tblevents VALUES ('$Log','$date','$time','Plympuma2','Created new job','0','')");
mysql_close();

require "c:/xampp/htdocs/vhs/Common/mail.php";
$query="DELETE FROM tblJobs WHERE Requestor=''";
mysql_query($query);



echo 'Job Loged';


?>